package com.may.ipersistence.sqlSession;

import com.may.ipersistence.config.XMLConfigBuilder;
import com.may.ipersistence.pojo.Configuration;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

/**
 * @program: lagou
 * @description:
 * @author: Bobby.Ma
 * @create: 2020-10-31 14:48
 **/
public class SqlSessionFactoryBuilder {
    public SqlSessionFactory build(InputStream in) throws DocumentException, PropertyVetoException {
        //解析配置文件
        XMLConfigBuilder configBuilder = new XMLConfigBuilder();
        Configuration configuration = configBuilder.parse(in);
        //创建 sqlSessionFactory 对象
        DefaultSqlSessionFactory defaultSqlSessionFactory = new DefaultSqlSessionFactory(configuration);
        SqlSession sqlSession = defaultSqlSessionFactory.openSession();
        return null;
    }
}
